import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:material_collection_app/utils/utils.dart';

class MessageCard extends StatefulWidget {
  final Map item;

  MessageCard({Key key, this.item}) : super(key: key);

  @override
  State<StatefulWidget> createState() => MyState();
}

class MyState extends State<MessageCard> {

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: false);
    // var item = widget.item;

    return GestureDetector(
      onTap: () {
        // Navigator.pushNamed(context, "/manage_detail", arguments: {'id': item['goods_id']});
      },
      onPanDown: (details) {
        FocusScope.of(context).requestFocus(FocusNode());
      },
      child: Column(
        children: <Widget>[
          Text(widget.item['create_time'], style: TextStyle(
            color: Utils.hexToColor('#333333'),
            fontSize: 12
          )),
          Container(
            width: 700.w,
            margin: EdgeInsets.only(top: 15, bottom: 18),
            // padding: EdgeInsets.fromLTRB(24.w, 20, 24.w, 24),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(8.w),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  width: double.infinity,
                  height: 40,
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.only(left: 24.w),
                  color: Utils.hexToColor('#fff9f4'),
                  child: Padding(
                    padding: EdgeInsets.only(bottom: 0),
                    child: Text('通知', style: TextStyle(
                      color: Color(0xFF333333),
                      fontSize: 15,
                      fontWeight: FontWeight.bold
                    )),
                  ),
                ),
                Row(
                  children: <Widget>[
                    Container(
                      width: 614.w,
                      margin: EdgeInsets.only(top: 10),
                      padding: EdgeInsets.fromLTRB(24.w, 0, 24.w, 24),
                      child: Text(widget.item['content'], 
                        maxLines: 3, 
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: Color(0xFF666666),
                          fontSize: 14,
                          height: 1.6
                        )
                      ),
                    ),
                  ],
                ),
              ]
            )
          )
        ],
      )
    );
  }
}